<?php
include_once "public/SQLorder.php";
include_once "public/connect.php";

//接受数据
$email = $_POST('email');
$pwd = md5($_POST('pwd1'));
$phone = $_POST('phone');

//邮箱正则
$verifyEmail = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
//手机
$verifyPhone = "/^1[34578]\d{9}$/";

if ( preg_match( $verifyEmail, $email )){
    if(preg_match( $verifyPhone, $phone )){
        if($_POST('pwd1')==$_POST('pwd2')){
            $arrAdd['email'] = $email;
            $arrAdd['pwd'] = $pwd;
            $arrAdd['phone'] = $phone;
            $res=add($arrAdd,$link,"users");
            if($res){
                echo "添加成功";
            }else{
                echo "添加失败";
            }
        }else{
            echo "两次输入的密码请相同";
        }
    }else{
        echo "请输入正确的手机格式";
    }
}else{
    echo "请输入正确的邮箱格式";
}




